package com.xiaoshu.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 功能说明： 对返回值进行封装，统一返回类型；
 *
 * @ com.xiaoshu.model
 * <p>
 * Original @Author: deane.jia-贾亮亮,@2020/9/29@14:16
 * <p>
 * Copyright (C)2012-@2020 深圳小树盛凯科技 All rights reserved.
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private int code;

    private String message;

    private long currentTimes;

    private T data;

    public ResultVo(ResultCode resultCode, T data) {
        this.code = resultCode.code();
        this.message = resultCode.msg();
        this.currentTimes = System.currentTimeMillis();
        this.data = data;
    }
}
